package com.navinfo.platform.common.service.impl;

import com.navinfo.platform.common.service.ILoadDataChannel;
import org.apache.spark.sql.SparkSession;

public enum LoadDataFromHdfs implements ILoadDataChannel {
    //
    INSTANCE;

    @SuppressWarnings("unchecked")
    @Override
    public <T> T readData(SparkSession spark, Object ... params) {
        String[] paths = new String[params.length];
        for(int i=0; i < params.length; i++){
            paths[i] = (String)params[i];
        }
        return (T) spark.read().parquet(paths);
    }
}
